VERSION  = 1.0.0
CC 		 = gcc
TARGET  = template
DEBUG    = -Wall -c
DEFAULT_SET  = -DUSE_DEBUG

inc_path =  -I./
inc_path += -I./func/

src_path =  ./
src_path += ./func/cmd_adapter/




src = $(foreach dir, $(src_path),$(wildcard $(dir)*.c))

obj_name = $(patsubst %.c, %.o, $(src))

$(TARGET) : $(obj_name)
	$(CC) $(obj_name) -o $(TARGET)
	@echo "makefile compile version:$(VERSION),target:$(TARGET)"
	mv $(obj_name) ./obj
	@echo "move obj_file to obj dircet"

%.o : %.c
	$(CC) $(DEFAULT_SET) $(DEBUG) $(inc_path) $^ -o $@


.PHONY :
clean:
	@echo "clean project"
	rm -rf $(TARGET) ./obj/*.o $(TARGET).exe.stackdump
	rm -rf obj
run:
	./$(TARGET).exe

all:
	make
	make run

# "-"的含义表示，删除不存在的文件时不报错